package com.js.domian.model.bot.support;

import cn.hutool.core.annotation.Alias;
import com.js.domian.model.bot.BaseApi;
import lombok.AccessLevel;
import lombok.Data;
import lombok.NoArgsConstructor;

public class SetGroupAddRequest extends BaseApi {

    private final Param param;

    public SetGroupAddRequest(String flag) {
        this.param = new Param();
        this.param.setFlag(flag);
        this.param.setSubType("invite");
        this.param.setApprove(true);
        this.param.setReason(null);
    }

    public SetGroupAddRequest(String flag, boolean approve, String reason) {
        this.param = new Param();
        this.param.setFlag(flag);
        this.param.setSubType("invite");
        this.param.setApprove(approve);
        this.param.setReason(reason);
    }

    @Override
    public String getAction() {
        return "set_group_add_request";
    }

    @Override
    public Object getParams() {
        return param;
    }

    @Data
    @NoArgsConstructor(access = AccessLevel.PRIVATE)
    public static class Param {
        @Alias("flag")
        private String flag;

        @Alias("sub_type")
        private String subType;

        @Alias("approve")
        private boolean approve;

        @Alias("reason")
        private String reason;

    }
}
